package com.thkj.business.complain.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.thkj.business.complain.service.impl.TblComplainService;
import com.thkj.util.RequestUtil;

import dp.R;
import dp.dao.PagingList;
import com.thkj.framework.base.BaseController;

/**
 * 投诉
 * @author weihuu
 *
 */
@RestController
@RequestMapping("/backstage/complain")
public class ComplainController extends BaseController {
    @Autowired
    TblComplainService tblComplainService;
    
    @RequestMapping("")
    public ModelAndView index(){
    	return new ModelAndView("complain/list");
    }
	
	@RequestMapping("/query")
    public R query(HttpServletRequest request, int page, int size){
    	Map<String, Object> param = RequestUtil.getParameterMap(request);
    	PagingList<Map> list = tblComplainService.query(page, size,param);
    	return R.success(list);
    }
	
	/**
	 * 解决问题
	 * @param request
	 * @return
	 */
	@RequestMapping("/solve")
    public R solve(HttpServletRequest request){
    	try {
    		Map<String, Object> param = RequestUtil.getParameterMap(request);
    		tblComplainService.solve(param);
        	return R.SUCCESS;
    	}catch (Exception e) {
			return R.failure(e.getMessage());
		}
    }
}